package com.crr.controller;

import com.crr.bean.CustomerCategory;
import com.crr.common.bean.ResultBean;
import com.crr.common.controller.BaseController;
import com.crr.service.CustomerCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/v1")
@Api(tags = "客户分类")
public class CustomerCategoryController extends BaseController {
    @Autowired
    CustomerCategoryService customerCategoryService;
    @PostMapping("/category/query")
    @ApiOperation("客户分类列表")
    public ResultBean query(){
        List<Map> list = customerCategoryService.queryAll();
        return success("客户类型列表",list);
    }
    @PutMapping("/category")
    @ApiModelProperty("修改客户分类")
    public ResultBean update(@RequestBody CustomerCategory category){
        int res = customerCategoryService.update(category);
        return updateResult(res);
    }
}
